src: use const parameters in base64_decode_slow()#12144
Closed
aqrln wants to merge 1 commit intonodejs:masterfrom
Closed
src: use const parameters in base64_decode_slow()#12144aqrln wants to merge 1 commit intonodejs:masterfrom
aqrln wants to merge 1 commit intonodejs:masterfrom
Conversation
Make parameters as const since it's both better at its own and consistent with base64_decode_fast() and base64_decode().
a5e8045 to
008bbbc
Compare
bnoordhuis
approved these changes
Mar 31, 2017
addaleax
approved these changes
Mar 31, 2017
cjihrig
approved these changes
Mar 31, 2017
richardlau
reviewed
Mar 31, 2017
| size_t base64_decode_slow(char* dst, size_t dstlen, | ||
| const TypeName* src, size_t srclen) { | ||
| size_t base64_decode_slow(char* const dst, const size_t dstlen, | ||
| const TypeName* const src, const size_t srclen) { |
Member
There was a problem hiding this comment.
Is the second const for src necessary?
Contributor
Author
There was a problem hiding this comment.
Not strictly necessary, but why not add it if we don't mutate the pointer? And that would be consistent with base64_decode_slow() (line 90) and base64_decode() (line 122).
Member
There was a problem hiding this comment.
@richardlau The first const declares the pointed-to memory immutable, the second one declares the pointer itself immutable (i.e., not reassignable.)
richardlau
approved these changes
Mar 31, 2017
Contributor
Author
|
Well, I've just tried to do something more interesting, so this PR will be a bit obsolete if everything's okay with #12146. |
jasnell
approved these changes
Mar 31, 2017
TimothyGu
approved these changes
Apr 1, 2017
Contributor
Author
|
Closing this as #12146 has landed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make parameters as
constsince it's both better at its own and consistent withbase64_decode_fast()andbase64_decode().Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
src